﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OneMile.DAL;
using OneMile.Entity.Model;

namespace OneMile.BLL
{
    public class BLLUCommodity:BaseBLL
    {

        private DALUCommodity dalCommodity;
        public DALUCommodity DALCommodity
        {
            get
            {
                if (dalCommodity == null)
                {
                    dalCommodity = DALFactory.getInstance().CreateUCommodityDAL();
                }
                return dalCommodity;
            }
        }


        public ECommodity GetCommodityById(string commodityId)
        {
            try
            {
                ECommodity commodity = DALCommodity.GetCommodityById(commodityId);
                commodity.CommodityAccessoriesList = DALCommodity.GetCommodityAccessoriesListById(commodityId);
                commodity.AttributeList = DALCommodity.GetAttributeListById(commodityId);
                commodity.SpecificationList = DALCommodity.GetSpecificationListById(commodityId);
                return commodity;
            }
            catch (Exception e)
            {
                
                base.WriteLog(e.Message);
                throw e;
            }
        }


    }
}
